<template>
  <div class="mobile-container">
    <div class="app-content">
      <!-- 头部 -->
      <div class="header">
        <div class="header-top">
          <div class="page-title">个人中心</div>
        </div>
        <!-- 用户信息区域 -->
        <div class="user-info-section">
          <div class="user-content">
            <div class="avatar">
              <img :src="require('../../../assets/images/Logo.png')" class="avatar-img" alt=""/>
              <div class="avatar-glow"></div>
            </div>
            <div class="user-details">
              <div class="nickname">用户昵称</div>
              <div class="user-id">ID: 123456789</div>
            </div>
            <div class="settings-icon" @click="handleSettings">
              <Icon icon="mdi:cog" />
            </div>
          </div>
        </div>
      </div>

      <!-- 广告数量 -->
      <div class="ad-section">
        <div class="ad-card">
          <div class="ad-item" @click="handleMyWPAdCount">
            <span class="ad-value">0</span>
            <span class="ad-label">WP广告数量</span>
          </div>
          <div class="ad-item" @click="handleMerchantWPAdCount">
            <span class="ad-value">0</span>
            <span class="ad-label">商家WP广告数量</span>
          </div>
        </div>
      </div>

      <!-- 功能列表 -->
      <div class="function-list">
        <div class="function-item" @click="handleCardPack">
          <div class="function-left">
            <Icon icon="mdi:wallet" class="function-icon" />
            <span class="function-text">卡包</span>
          </div>
          <Icon icon="mdi:chevron-right" class="function-arrow" />
        </div>

        <div class="function-item" @click="handleMerchantCode">
          <div class="function-left">
            <Icon icon="mdi:qrcode" class="function-icon" />
            <span class="function-text">商家码</span>
          </div>
          <Icon icon="mdi:chevron-right" class="function-arrow" />
        </div>

        <div class="function-item" @click="handleDownload">
          <div class="function-left">
            <Icon icon="mdi:download" class="function-icon" />
            <span class="function-text">置换宝下载</span>
          </div>
          <Icon icon="mdi:chevron-right" class="function-arrow" />
        </div>
      </div>

      <!-- 底部导航 -->
      <NavLayout />
    </div>
  </div>
</template>

<script>
import NavLayout from '@/layout/components/Navbar/index.vue'
import { Icon } from '@iconify/vue2'

export default {
  name: 'MinePage',
  components: {
    Icon,
    NavLayout
  },
  data() {
    return {
      activeNav: 'mine'
    }
  },
  methods: {
    handleSettings() {
      this.$router.push('/userdistribution/settings')
    },
    handleMyWPAdCount(){
      this.$router.push('/userdistribution/mywpad')
    },
    handleMerchantWPAdCount(){
      this.$router.push('/userdistribution/merchantwpad')
    },
    handleCardPack() {
      this.$router.push('/userdistribution/card')
    },
    handleMerchantCode() {
      this.$router.push('/userdistribution/merchant-code')
    },
    handleDownload() {
      this.$router.push('/userdistribution/download')
    }
  }
}
</script>

<style scoped>
.mobile-container {
  width: 100%;
  min-height: 100vh;
  background: #f5f5f5;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  padding: 20px;
}

.app-content {
  width: 375px;
  min-height: 667px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.header {
  padding: 20px 20px 15px;
  background: white;
}

.header-top {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
  height: 36px;
}

.page-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

/* 用户信息区域 */
.user-info-section {
  padding: 0 0 10px;
}

.user-content {
  display: flex;
  align-items: center;
  height: 120px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  position: relative;
  z-index: 3;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  position: relative;
  z-index: 2;
}

.avatar-glow {
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.2) 0%, transparent 70%);
  animation: avatarGlow 3s ease-in-out infinite;
  z-index: 1;
}

@keyframes avatarGlow {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

.user-details {
  flex: 1;
  position: relative;
  z-index: 3;
}

.nickname {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 3;
}

.user-id {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 3;
}

.settings-icon {
  cursor: pointer;
  color: white;
  font-size: 24px;
  transition: all 0.3s ease;
  position: relative;
  z-index: 3;
  padding: 8px;
  width: 40px;
  height: 40px;
  transform-origin: center center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.settings-icon:hover {
  transform: rotate(90deg);
}

/* 广告数量 */
.ad-section {
  padding: 0 30px 10px;
}

.ad-card {
  border-radius: 15px;
  padding: 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.ad-item {
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  position: relative;
  z-index: 2;
}

.ad-item:hover {
  cursor: pointer;
  transform: translateY(-2px);
  transition: transform 0.3s ease;
}

.ad-value {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ad-label {
  color: white;
  font-size: 14px;
  opacity: 0.9;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 功能列表 */
.function-list {
  flex: 1;
  padding: 0 20px;
}

.function-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 10px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

.function-item:hover {
  background: #f8f9fa;
  transform: translateX(5px);
}

.function-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.function-icon {
  font-size: 20px;
  color: #667eea;
}

.function-text {
  font-size: 16px;
  color: #333;
  font-weight: 500;
}

.function-arrow {
  color: #999;
  font-size: 18px;
}

@media (max-width: 375px) {
  .mobile-container {
    padding: 0;
  }

  .app-content {
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
  }
}
</style>
